package org.infodavid.common.model;

import org.infodavid.common.persistence.ICommented;
import org.infodavid.common.persistence.IDataObject;
import org.infodavid.common.persistence.INamed;

/**
 * The Interface IUserGroup.
 */
public interface IUserGroup extends IDataObject<Long>, INamed, ICommented, IGenericObject {

  /**
   * The Enum EUserRole.
   */
  enum EUserRole {
    /** The SYSTEM. */
    SYSTEM(0),
    /** The ADMINISTRATORS. */
    ADMINISTRATORS(1),
    /** MANAGERS. */
    MANAGERS(2),
    /** OPERATORS. */
    OPERATORS(3),
    /** NORMAL. */
    NORMAL(4);

    /** The value. */
    private final int value;

    /**
     * Instantiates a new role.
     * @param arg the arg
     */
    private EUserRole(final int arg) {
      value = arg;
    }

    /**
     * Gets the value.
     * @return the value
     */
    public int getValue() {
      return value;
    }
  }

  /** The constant LOCAL_BEAN_JNDI_NAME. */
  String LOCAL_BEAN_JNDI_NAME = "IUserGroup/local";
  /** The GUEST. */
  String GUEST = "guest";
  /** The ID. */
  String ID = "groupKey";
  /** The LOCKED. */
  String LOCKED = "locked";
  /** The ROLE. */
  String ROLE = "role";
  /** The USER_GROUP. */
  String USER_GROUP = "userGroup";

  /**
   * Gets the role.
   * @return the role
   */
  EUserRole getRole();

  /**
   * Checks if is one of the default groups for guest users.
   * @return true, if checks if is a default group
   */
  boolean isGuest();

  /**
   * Checks if is locked.
   * @return true, if checks if is locked
   */
  boolean isLocked();

  /**
   * Sets the guest flag.
   * @param flag the flag
   */
  void setGuest(boolean flag);

  /**
   * Sets the locked.
   * @param flag the flag
   */
  void setLocked(boolean flag);

  /**
   * Sets the role.
   * @param value the role
   */
  void setRole(EUserRole value);
}
